package test5;

public class Test05 {
    public static void main(String[] args) {
     connect c= new connect() {
         @Override
         public void open() {
             System.out.println("连接了");
         }

         @Override
         public void close() {
             System.out.println("断开了");
         }
     };
     keyboardConnect(c);
     keyboardDisconnect(c);
     mouseConnect(c);
     mouseDisconnect(c);
    }


 interface connect {
        void open();

        void close();

    }




    public  static void keyboardConnect(connect c){
        System.out.print("键盘");
        c.open();
    }
    public static void keyboardDisconnect(connect c){
        System.out.print("键盘");
        c.close();
    }
    public static void mouseConnect(connect c){
        System.out.print("鼠标");
        c.open();
    }
    public static void mouseDisconnect(connect c){
        System.out.print("鼠标");
        c.close();
    }

}
